<template>
  <swiper ref="mySwiper" :options="swiperOptions" v-if="List.length">
    <swiper-slide class="center" v-for="item of List" :key="item.id">
      <img class="img" :src="item.imgUrl" />
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
</template>

<script>
export default {
  name: "carrousel",
  props:{
    List:Array
  },
  data() {
    return {
      swiperOptions: {
        pagination: {
          el: ".swiper-pagination",
        },
        loop: true,
        // Some Swiper option/callback...
      },
    };
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper;
    },
  },
  mounted() {
    this.swiper.slideTo(0, 1000, false);
  },
};
</script>

<style  scoped>
.center {
  text-align: center;
  overflow: hidden;
  /* background-color: rgb(0, 217, 255); */
}
.img{
  width: 100%;
}

</style>
